package com.gimi.cloud.bbp.manage.consumer.service.impl;

import com.gimi.cloud.bbp.common.enums.ResponseCodeEnum;
import com.gimi.cloud.bbp.common.utils.reqhead.Response;
import com.gimi.cloud.bbp.dto.sys.SysMasterDTO;
import com.gimi.cloud.bbp.manage.consumer.feign.SystemFeignService;
import com.gimi.cloud.bbp.manage.consumer.service.IndexService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 首页相关service
 *
 * @author wbj
 * @version 1.0
 * @Description TODO
 * @create 2017-12-22
 **/
@Service
public class IndexServiceImpl  implements IndexService {
    private static final Logger loger = LoggerFactory.getLogger(IndexServiceImpl.class);
    private SystemFeignService systemFeignService;

    @Autowired
    public IndexServiceImpl(SystemFeignService systemFeignService) {
        this.systemFeignService = systemFeignService;
    }

    @Override
    public Response getPermission(HttpServletRequest request, HttpServletResponse response, SysMasterDTO sysMasterDTO) throws Exception {
        Response resp = null;
        if(null == sysMasterDTO.getUid()){
            resp =  new Response();
            resp.setResponseCode(ResponseCodeEnum.PARAMETER_ERROR);
            resp.setRes_msg("未获取到登录用户信息");
            return resp;
        }
        return systemFeignService.masterPermission(sysMasterDTO);
    }
}
